<template>
  <div class="app-main-container">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/application/applicationCenter' }" :replace="true">应用中心</el-breadcrumb-item>
      <el-breadcrumb-item>发票开具</el-breadcrumb-item>
    </el-breadcrumb>
    <el-tabs v-model="activeTab" class="mt20">
      <el-tab-pane label="会员发票开具" name="1"><InvoiceMember v-if="activeTab === '1'" :meta="meta" @changeTabs="changeTabs" /></el-tab-pane>
      <el-tab-pane label="散客发票开具" name="2"><InvoiceNoMember v-if="activeTab === '2'" :meta="meta" @changeTabs="changeTabs" /></el-tab-pane>
      <el-tab-pane label="开具历史" name="0"><InvoiceList v-if="activeTab === '0'" :meta="meta" /></el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import InvoiceList from './components/invoiceList.vue'
import InvoiceMember from './components/invoiceMember.vue'
import InvoiceNoMember from './components/invoiceNoMember.vue'
export default {
  name: 'Invoice',
  components: {
    InvoiceList,
    InvoiceMember,
    InvoiceNoMember
  },
  data() {
    return {
      activeTab: '1',
      meta: []
    }
  },
  created() {
    this.meta = this.$route.meta.buttons || []
    if (this.$route.query.activeTab) {
      this.activeTab = this.$route.query.activeTab
    }
  },
  activated() {
    if (this.$route.query.activeTab) {
      this.$refs.taskAdminRef.handleQuery()
    }
    if (this.$route.query.activeTab) {
      this.activeTab = this.$route.query.activeTab
    }
  },
  methods: {
    changeTabs(val) {
      this.activeTab = val
    }
  }

}
</script>

<style lang="scss" scoped>

</style>
